﻿@model IEnumerable<ContosoUniversity.Web.Core.Repository.Projections.CourseDetail>
@{
    ViewBag.Title = "Courses";
}

<h2>Courses</h2>

<p>
    @Html.ActionLink("Create New", "Create")
</p>

@using (Html.BeginForm())
{
    <p>
        Select Department: @Html.DropDownList("SelectedDepartment", "All")
        <input type="submit" value="Filter" />
    </p>
}

<table id="courses" class="table">   
    <tr>
        <th>
            CourseID
        </th>
        <th>
            Title
        </th>
        <th>
            Credits
        </th>
        <th>
            Department
        </th>
        <th></th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @item.CourseID
            </td>
            <td>
                @item.Title
            </td>
            <td>
                @item.Credits
            </td>
            <td>
                @item.DepartmentName
            </td>
            <td>
                @Html.ActionLink("Edit", "Edit", new { id = item.CourseID }) |
                @Html.ActionLink("Details", "Details", new { id = item.CourseID }) |
                @Html.ActionLink("Delete", "Delete", new { id = item.CourseID })
            </td>
        </tr>
    }

</table>